﻿using Abp.AutoMapper;
using Abp.Modules;
using AbpZeroTemplate.Configuration;
using AbpZeroTemplate.Web;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using System.Reflection;

namespace AbpZeroTemplate.Api.App
{
    /// <summary>应用接口
    /// </summary>
    [DependsOn(
        typeof(AbpZeroTemplateWebCoreModule)
    )]
    public class AbpZeroTemplateApiAppModule : AbpModule
    {
        private readonly IHostingEnvironment _env;
        private readonly IConfigurationRoot _appConfiguration;
        /// <summary>
        /// </summary>
        public AbpZeroTemplateApiAppModule(IHostingEnvironment env)
        {
            _env = env;
            _appConfiguration = env.GetAppConfiguration();

        }

        /// <summary>
        /// </summary>
        public override void Initialize()
        {
            IocManager.RegisterAssemblyByConvention(Assembly.GetExecutingAssembly());
            //AutoMapper
            Configuration.Modules.AbpAutoMapper().Configurators.Add(CustomAutoMapper.CreateMappings);
        }
    }
}
